using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Text;
using System.Windows.Forms;
using DevComponents.DotNetBar;
using BLL;
using Public;

namespace QLNhanKhau
{
    public partial class frmThietLap : DevComponents.DotNetBar.Metro.MetroForm
    {
        public frmThietLap()
        {
            InitializeComponent();
        }

        private void frmThietLap_Load(object sender, EventArgs e)
        {
            //load tỉnh
            cmbTinh.DataSource = TinhBLL.LoadTinh();
            cmbTinh.DisplayMember = "TenTinh";
            cmbTinh.ValueMember = "MaT";
            //load huyện
            cmbQuanHuyen.DataSource = QuanHuyenBLL.LoadQuanHuyen();
            cmbQuanHuyen.DisplayMember = "TenQuanHuyen";
            cmbQuanHuyen.ValueMember = "MaQH";
            //load xã
            cmbPhuongXa.DataSource = PhuongXaBLL.LoadPhuongXa();
            cmbPhuongXa.DisplayMember = "TenPhuongXa";
            cmbPhuongXa.ValueMember = "MaPX";
        }

        private void btnLuu_Click(object sender, EventArgs e)
        {
            ThietLapPublic tl = new ThietLapPublic();
            tl.MaPX = (byte)cmbPhuongXa.SelectedValue;
            tl.MaQH = (byte)cmbQuanHuyen.SelectedValue;
            //tl.MaT = (byte)cmbTinh.SelectedValue;
            ThietLapBLL.InsertThietLap(tl);
        }
    }
}